﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TransFormer.BLL;

namespace TransFormer.Web.admin
{
    public partial class ClientAdd : AdminPage
    {
        private BLL.Clients _bll = new Clients();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            int id = -1;
            if (int.TryParse(Request["Id"], out id))
            {
                var model = _bll.GetModel(id);
                txtId.Text = model.Id.ToString();
                txtTitle.Text = model.Title;
                txtMessage.Text = model.Message;
                txtEmail.Text = model.Email;
                txtPhone.Text = model.Phone;
                txtQQ.Text = model.QQ;
                txtDate.Text = model.Date.ToString();
                txtLinkMan.Text = model.LinkMan;

                model.IsReaded = true;

                _bll.Update(model);
            }
        }

        protected void btnOK_Click(object sender, EventArgs e)
        {
            Response.Redirect("clientList.aspx");
        }
    }
}